﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link href="~/Content/AUI/css/aui.css" rel="stylesheet" />
    <link href="~/Content/AUI/css/aui-flex.css" rel="stylesheet" />
    <link href="~/Content/AUI/css/aui-calendar.css" rel="stylesheet" />
    <title></title>
</head>
<body>
    <div class="aui-center">
        <header class="aui-bar aui-bar-nav aui-bar-light">
            <a tapmode onclick="javascript: history.go(-1)" class="aui-pull-left"><span class="aui-iconfont aui-icon-left"></span></a>
            <span style="margin-left:-50px">查询预约的体检信息</span>
        </header>
    </div>
    <form action="Queryorder" method="get" name="Queryorder" enctype="multipart/form-data">
        <div class="aui-flex-col aui-flex-center aui-border-tb">
            <div class="aui-flex-item-12 aui-padded-5 ">
                <div class="aui-flex-item-9 aui-padded-5">
                    <input type="number" id="IdCard" required name="IdCard" class="as-inline-block" placeholder="请输入您的身份证号码" />
                </div>
                <div class="aui-flex-item-3 aui-padded-10 ">
                    <button class="aui-btn aui-btn-info aui-btn-block aui-btn-outlined aui-btn-sm" onsubmit="return Serach()">
                        <i class="aui-iconfont aui-icon-search">查询</i>
                    </button>
                </div>
            </div>
        </div>
    </form>
    <form method="post" id="CancelOrder" enctype="multipart/form-data">
        <div class="aui-content aui-margin-b-15">
            <ul class="aui-list aui-list-in">
                @{
                    foreach (var item in ViewBag.alreadybooked)
                    {
                        <li class="aui-list-item aui-list-item-middle">
                            <div class="aui-list-item-inner aui-list-item-arrow">
                                <div class="aui-list-item-title">
                                    @*  <a class="aui-arrow-right" onclick="return CancelOrder()">*@
                                    <h3>美亚体检</h3>
                                    <p>体检人：<span id="Name">@item.Name</span></p><input type="hidden" value="@item.Name" name="Name" />
                                    <p>体检机构：<span id="OrgName">@item.OrgName</span></p><input type="hidden" value="@item.OrgName" name="OrgName" />
                                    <p>预约时间：<span id="bookDate">@item.bookDate</span></p><input type="hidden" value="@item.bookDate" name="bookDate" />
                                    <p>预约编号：<span id="orderNo">@item.orderNo</span></p><input type="hidden" value="@item.orderNo" name="orderNo" />
                                    <p>体检地址：<span id="OrgAddress">@item.OrgAddress</span></p><input type="hidden" value="@item.OrgAddress" name="OrgAddress" />
                                    @* </a>*@
                                    <div>
                                        <input class="aui-btn aui-btn-default" onclick="CancelOrder()" type="button" value="取消预约" />
                                    </div>
                                </div>
                            </div>
                        </li>
                    }
                }
            </ul>
        </div>
    </form>
</body>
</html>
<script src="~/Content/AUI/script/api.js"></script>
<script src="~/Content/AUI/script/aui-tap.js"></script>
<script src="~/Content/AUI/script/aui-dialog.js"></script>
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script>
    function CancelOrder() {
        var dialog = new auiDialog({});
        dialog.alert({
            title: "温馨提示",
            msg: '确认取消已预约的体检？',
            buttons: ['取消', '确定']
        }, function (ret) {
            if (ret.buttonIndex == 1) {
                return false;
            }
            else {
                if (ret.buttonIndex == 2) {
                    $.ajax({
                        type: "Post",
                        url: "/Store/CancelOrder",
                        data: $("#CancelOrder").serialize(),
                        success: function (result) {
                            result = eval("(" + result + ")");//转换为json对象
                            if (result.IsSuccess) {
                                alert(result.Message);
                                location.href = '/Mobile/Home/Index';
                            }
                            if (!result.IsSuccess) {
                                alert(result.Message);
                                history.back(-1);
                            }
                        }
                    });
                }
            }
        });
    }
</script>